import org.newdawn.slick.*;
/**
 * The singleplayer gamemode class. Sets up the game for single player play.
 * Initializes the level controller to be used in this gamemode.
 * 
 * @author Gerrit Jamerson, CodeMonkeys
 * @version 4/3/13
 */
public class GMSingleplayer implements IGamemode
{
    private ILevelController levelController;   //The level controller
    private PlayerController playerController;  //The player controller

    /**
     * Constructs/initializes the singleplayer gamemode.
     */
    public GMSingleplayer()
    {
    } //End constructer

    /**
     * Initializes the gamemode. This is where necessary objects should be instantiated.
     * 
     * @pre None
     * @param None
     * @return Void
     */
    public void initialize()
    {
        System.out.println("Singleplayer Gamemode Initialized.");
        
        levelController = new SPLevelController();
        playerController = new PlayerController();
        
        LayerController.initialize(this);
        
    } //End initialize method

    /**
     * Returns the level controller
     * 
     * @pre None
     * @param None
     * @return The level controller
     * @post None
     */
    public ILevelController getLevelController()
    {
        return levelController;
    } //End getLevelController method

    /**
     * Called each frame. Used to draw the layer.
     * 
     * @pre None
     * @param gameContainer The gameContainer
     * @param graphics The Graphics class
     * @return void
     * @post The layer is drawn onto the screen, if needed
     */
    public void render(GameContainer gameContainer, Graphics graphics)
    {
        playerController.render(gameContainer, graphics);
    } // End render method

    /**
     * Called each step. Used to update the layer.
     * 
     * @pre None
     * @param gameContainer The gameContainer
     * @param intDelta The delta time between updates
     * @return void
     * @post The layer is drawn onto the screen, if needed
     */
    public void update(GameContainer gameContainer, int intDelta)
    {
        playerController.update(gameContainer, intDelta);
        LayerController.update(gameContainer, intDelta);
        levelController.update(gameContainer, intDelta);
    } //End update method

    /**
     * Called when a key is pressed.
     * 
     * @pre None
     * @param key The key that was pressed.
     * @return void
     * @post None
     */
    public void keyPressed(Keys key)
    {
        playerController.keyPressed(key);
    } //End keyPress method

    /**
     * Called when a key is pressed.
     * 
     * @pre None
     * @param key The key that was released.
     * @return void
     * @post None
     */
    public void keyReleased(Keys key)
    {
        playerController.keyReleased(key);
    } //End keyRelease method
    
    
} //End class
